package com.fqgj.xjd.user.dao;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.BaseMapper;
import com.fqgj.xjd.user.entity.UserEntity;

import java.util.List;

/**
 * User: zhangxingyun
 * Date: 2017-07-20
 * Time: 18:38:52.670
 */

public interface UserDao extends BaseMapper<UserEntity> {

    /**
     * @param id
     * @return
     */
    UserEntity selectByPrimaryKey(long id);


    /**
     * @param userCode
     * @return
     */
    @Deprecated
    UserEntity selectByUserCode(String userCode);

    /**
     * @param mobile
     * @return
     */
    List<UserEntity>  selectByMobile(String mobile);

    List<UserEntity>  selectByMD5Mobile(String md5Mobile);

    List<UserEntity>  selectByMD5MobileIdNo(String md5MobileIdNo);

    List<UserEntity>  selectByMobileAndCategories(String mobile,List<String>  categories);

    /**
     * 通过姓名查询 用户id
     *
     * @param name 姓名
     * @return
     */
    List<Long> selectByName(String name);


    int countByMobile(String mobile);


    /**
     * @param userCodes
     * @return
     */
    List<UserEntity> selectByUserCodes(List<String> userCodes);


    /**
     * @param mobile
     * @return
     */
    List<UserEntity> selectByMobileAndPage(String mobile, Page page);

    /**
     * @param userId
     * @param userName
     * @return
     */
    Boolean updateUserName(Long userId, String userName);

    /**
     * 根据身份证获取用户
     *
     * @param identityNo
     * @return
     */
    @Deprecated
    UserEntity selectByIdentityNo(String identityNo);

    /**
     * 根据身份证获取用户列表
     */
    List<UserEntity> selectUserListByIdentityNo(String identityNo);

    List<UserEntity> selectUserListByIdentityNoAndUserCategories(String identityNo,List<String> categories);

    UserEntity selectByIdentityNoAndAppCode(String identityNo, String appCode, Integer biz);

    List<UserEntity> selectByNamePrefix(String namePrefix);

    UserEntity selectByCustomerCode(String customerCode);

    /**
     * 插入deleted置1的记录
     *
     * @param entity
     * @return
     */
    int initInsert(UserEntity entity);
}